import request from '@/utils/request.js';

//查询新闻列表
export function getNewsList(NewsPageDto) {
  return request({
    url: '/environment/queryNewsList',
    method: 'post',
      data: NewsPageDto
  });
}
//添加点击量
export function addClickCount(newsId) {
  return request({
    url: '/environment/addClickCount',
    method: 'put',
   params: {newsId:newsId}
  });

}
//查询点击量前五的新闻
export function getTop5News() {
  return request({
    url: '/environment/queryTop5News',
    method: 'get'
  });
}


export function getCarbonStats(userId,period) {
  return request({
    url: '/environment/stats',
    method: 'get',
    params: { userId : userId, period : period }
  });
}
//查询用户的积分排行榜Top10
export function getRankList() {
  return request({
    url: '/environment/queryUserRank',
    method: 'get'
  });
}

//查询用户碳排放分布
export function getCarbonDistribution(userId) {
  return request({
    url: '/environment/queryUserCarbonDistribution',
    method: 'get',
    params: { userId : userId }
  });
}

export function getSignInCalendar(userId) {
  return request({
    url: '/environment/calendar',
    method: 'get',
    params: { userId }
  });
}

export function signInAPI(userId) {
  return request({
    url: '/environment/sign',
    method: 'post',
    params: { userId }
  });
}